package com.bstek.bdf4.mybatis.core.handlers;

import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;

import com.bstek.bdf4.utils.JsonUtils;
import com.fasterxml.jackson.core.type.TypeReference;

import java.util.Set;

/**
 * @Description:  json转换处理器
 * @Author: zxq
 * @Date: 2024/1/25 - 17:10
 */
public class JsonLongSetTypeHandler extends AbstractJsonTypeHandler<Object> {

    private static final TypeReference<Set<Long>> typeReference = new TypeReference<Set<Long>>(){};

    @Override
    protected Object parse(String json) {
        return JsonUtils.parseObject(json, typeReference);
    }

    @Override
    protected String toJson(Object obj) {
        return JsonUtils.toJsonString(obj);
    }

}
